<template>
  <div class="block_main blue-tit">
    <!-- <div class="nytit">首页&gt;通知/督办</div> -->
    <el-row style="padding-top: 10px">
      <el-col :span="24" style="padding:0 5px">
        <el-card>
          <div class="title">
            <em>{{proTitle}}</em>
          </div>
        <el-form style="padding: 0 2%"  size="small">
            
            <el-form-item label="项目名称">
              <el-input v-model="name"></el-input>
            </el-form-item>

          </el-form>
            <div class="editmain">
                <label>特殊环节</label>
                <u-edit style="margin:2%" :defaultMsg="special" :config="config" :id="ue1" ref="UE1"></u-edit>
            </div>
            <div class="editmain">
                <label>办理结果样本</label>
                <u-edit style="margin:2%" :defaultMsg="sample" :config="config2" :id="ue2" ref="UE2"></u-edit>
            </div>
            <div class="editmain">
                <label>基本信息</label>
                <u-edit style="margin:2%" :defaultMsg="info" :config="config2" :id="ue3" ref="UE3"></u-edit>
            </div>
            <div class="editmain">
                <label>受理标准</label>
                <u-edit style="margin:2%" :defaultMsg="standard" :config="config2" :id="ue4" ref="UE4"></u-edit>
            </div>
            <div class="editmain">
                <label>设定依据</label>
                <u-edit style="margin:2%" :defaultMsg="basis" :config="config2" :id="ue5" ref="UE5"></u-edit>
            </div>
            <div class="editmain">
                <label>收费标准及依据</label>
                <u-edit style="margin:2%" :defaultMsg="cost" :config="config2" :id="ue6" ref="UE6"></u-edit>
            </div>
            <div class="editmain">
                <label>办理流程</label>
                <u-edit style="margin:2%" :defaultMsg="process" :config="config2" :id="ue7" ref="UE7"></u-edit>
            </div>
            <div class="editmain">
                <label>办理流程图</label>
                <u-edit style="margin:2%" :defaultMsg="pro_pic" :config="config2" :id="ue8" ref="UE8"></u-edit>
            </div>
            <div class="editmain">
                <label>办理材料</label>
                <u-edit style="margin:2%" :defaultMsg="pro_data" :config="config2" :id="ue9" ref="UE9"></u-edit>
            </div>
            
            <div class="editmain">
                <label>常见诉求</label>
                <u-edit style="margin:2%" :defaultMsg="common" :config="config2" :id="ue11" ref="UE11"></u-edit>
            </div>
            <el-form style="padding: 0 2%"  size="small">
                <el-form-item label="在线办理地址">
                <el-input v-model="online"></el-input>
                </el-form-item>
             </el-form>
            <div class="editmain">
            <el-button style="margin:2%" @click="formSubmit" type="success" size="small">{{proTitle}}</el-button>
            </div>

        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import actionurl from "@/assets/js/actionurl";
import config from "@/config.js";
import uEdit from "@/components/uEdit.vue";

export default {
  components: {},
  data() {
    return {
        proTitle:'编辑',
      loading: false,
      defaultMsg: "",
      name:'',
      ue1: "ue1",
      ue2: "ue2",
      ue3: "ue3",
      ue4: "ue4",
      ue5: "ue5",
      ue6: "ue6",
      ue7: "ue7",
      ue8: "ue8",
      ue9: "ue9",
      ue10: "ue10",
      ue11: "ue11",
      special:'',
      sample:'',
      info:'',
      standard:'',
      basis:'',
      cost:'',
      process:'',
      pro_pic:'',
      pro_data:'',
      common:'',
      config: {
        initialFrameWidth: null,
        initialFrameHeight: 200
      },
      config2: {
        initialFrameWidth: null,
        initialFrameHeight: 200
      },
      tableData: [],
      urlId:'',
      online:''
    };
  },
  components: {
    uEdit
  },
  
  methods: {
    getUEContent() {
      let content = this.$refs.UE.getUEContent();
      // this.$notify({
      // title: '获取成功，可在控制台查看！',
      // message: content,
      // type: 'success'
      // });
      // console.log(content);
    },
    getUE2(){
        let content = this.$refs.UE2.getUEContent();
        // console.log(content);
    },
    addUrlFn(){//添加事件
      var _this = this;
      actionurl.GroupdoAdd({
        name:_this.name,
        special:_this.$refs.UE1.getUEContent(),
        sample:_this.$refs.UE2.getUEContent(),
        info:_this.$refs.UE3.getUEContent(),
        standard:_this.$refs.UE4.getUEContent(),
        basis:_this.$refs.UE5.getUEContent(),
        cost:_this.$refs.UE6.getUEContent(),
        process:_this.$refs.UE7.getUEContent(),
        pro_pic:_this.$refs.UE8.getUEContent(),
        pro_data:_this.$refs.UE9.getUEContent(),
        group:_this.$route.params.fid,
        url:_this.online,
        common:_this.$refs.UE11.getUEContent(),
        
      }, function(re) {
        _this.loading=false;
        _this.dialogVisibleSupervise = false;
        _this.$message(re.msg);
        if(re.status == 1){
          _this.$router.go(-1)
        }
      });
    },
    editUrlFn(){
      var _this = this;
      actionurl.WdoEdit({
        id:_this.$route.params.id,
        name:_this.name,
        special:_this.$refs.UE1.getUEContent(),
        sample:_this.$refs.UE2.getUEContent(),
        info:_this.$refs.UE3.getUEContent(),
        standard:_this.$refs.UE4.getUEContent(),
        basis:_this.$refs.UE5.getUEContent(),
        cost:_this.$refs.UE6.getUEContent(),
        process:_this.$refs.UE7.getUEContent(),
        pro_pic:_this.$refs.UE8.getUEContent(),
        pro_data:_this.$refs.UE9.getUEContent(),
        group:_this.$route.params.fid,
        url:_this.online,
        common:_this.$refs.UE11.getUEContent(),
        
      }, function(re) {
        _this.loading=false;
        _this.dialogVisibleSupervise = false;
        _this.$message(re.msg);
        if(re.status == 1){
          _this.$router.go(-1)
        }
      });
    },
    formSubmit(){
      if(this.urlId == '-1'){
         this.addUrlFn();
      }else{
        this.editUrlFn();
      }
    },
    getEditInfo(){
      var _this = this;
      actionurl.WgetEditInfo({
        id:_this.$route.params.id
      },function(re){
        _this.name = re.data.name;
        _this.url = re.data.url;
        _this.special=re.data.special;
        _this.sample=re.data.sample;
        _this.info=re.data.info;
        _this.standard=re.data.standard;
        _this.basis=re.data.basis;
        _this.cost=re.data.cost;
        _this.process=re.data.process;
        _this.pro_pic=re.data.pro_pic;
        _this.pro_data=re.data.pro_data;
        _this.common=re.data.common;
      });
    }
  },
  created() {
      this.urlId = this.$route.params.id;
      console.log(this.$route.params.id);
      if(this.urlId == '-1'){
          this.proTitle = '新增';
      }else{
        this.getEditInfo();
      }
  }
};
</script>

<style lang="scss" scoped>
.editmain{
    label{
        padding:2%;
        font-size: 14px;
    }
}
</style>
